package com.demo.springbootdemo.domain.po;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.demo.springbootdemo.enums.UserStatus;
import lombok.Data;

import java.time.LocalDateTime;

@Data
@TableName(value = "user", autoResultMap = true)
public class User {

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    private String username;
    private String password;
    private String phone;
    private LocalDateTime createTime;
    private LocalDateTime updateTime;
    private Integer balance;
    private UserStatus status;

    // json类型字段转换不支持全局配置，所以需要在实体类字段注解声明，另外需要在实体类注解设置autoResultMap=true
    @TableField(typeHandler = JacksonTypeHandler.class)
    private UserInfo info;
}
